﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace Gmantis.Controls.Test
{
    public partial class GWindow : UserControl, IDisposable
    {
        public GWindow()
        {
            InitializeComponent();
            CenterOnScreen = true;
        }

        private void CreateWindow_Click(object sender, RoutedEventArgs e)
        {
            Gmantis.Controls.GWindow win = new Controls.GWindow();

            win.Header = "This is the header";
            win.ShowCloseButton = false;
            win.ShowMaximizeButton = false;
            win.ShowMinimizeButton = false;
            win.IsResizable = false;
            win.Width = 500;
            win.Height = 400;
            win.Content = new ComboBox();

            if (CenterOnScreen)
            {
                win.CenterOnScreen();
            }
            win.Show();
            windows.Add(win);
        }


        private void CreateModal_Click(object sender, RoutedEventArgs e)
        {
            Gmantis.Controls.GWindow win = new Controls.GWindow();
            Gmantis.Controls.Test.Loader loader = new Loader();
            //win.IsResizable = false;
            //win.Height = 100;
            //win.Width = 100;
            //win.Content = loader;
            //win.ShowCloseButton = false;
            //win.ShowMaximizeButton = false;
            //win.ShowMinimizeButton = false;
            //win.Header = "加载中...";
            //if (CenterOnScreen)
            //{
            //    win.CenterOnScreen();
            //}
            //win.ShowModal();
            //windows.Add(win);
            win.ShowCloseButton = false;
            win.ShowMaximizeButton = false;
            win.ShowMinimizeButton = false;
            win.Content = loader;
            win.IsResizable = false;
            win.ShowModal();
            win.Height = 100;
            win.Width = 100;
            win.Header = "In Progress...";
            win.CenterOnScreen();
        }

        public string DEMO_Content { get; set; }
        public string DEMO_Header { get; set; }
        public int DEMO_Width { get; set; }
        public int DEMO_Height { get; set; }
        public int DEMO_Left { get; set; }
        public int DEMO_Top { get; set; }
        public bool CenterOnScreen { get; set; }

        List<Gmantis.Controls.GWindow> windows = new List<Gmantis.Controls.GWindow>();
        public void Dispose()
        {
            foreach (var w in windows)
            {
                w.Close();
            }
        }
    }
}
